package day02;import com.rabbitmq.client.Channel;import com.rabbitmq.client.Connection;import com.rabbitmq.client.ConnectionFactory;import com.rabbitmq.client.GetResponse;import java.io.IOException;import java.util.concurrent.TimeoutException;/** * @Auther: sky * @Date: 2019/3/20 22:34 * @Description:拉模式,每次只拉一条数据 */public class GetResponseDemo {    private static final String QUEUE_NAME = "queuedemo3";    public static void main(String[] args) throws IOException, TimeoutException {        ConnectionFactory factory = new ConnectionFactory();//        factory.setHost("192.168.1.104");        factory.setHost("127.0.0.1");        Connection conection = factory.newConnection();        Channel channel = conection.createChannel();        GetResponse response =  channel.basicGet(QUEUE_NAME,  false);        System.out.println(new String(response.getBody()));        channel.basicAck(response.getEnvelope() .getDeliveryTag(),false);    }}